//
//  Customers.h
//  A One POS
//
//  Created by AonePOS on 24/09/13.
//  Copyright (c) 2013 AonePOS. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "CustomerCell.h"
#import "CustomerHistoryCell.h"

@interface Customers : UIViewController<UITextFieldDelegate,UITextViewDelegate,UITableViewDelegate,UITableViewDataSource>
{
   
    UIView *sidemenu,*mainview,*backgroundcolorview;
    UIButton *categorybutton;
    UIToolbar *downtoolBar,*maintoolBar;
    UIImageView *logobackview,*logoimageview;
    int y,p;
    _Bool isLandScope;
    UIButton *helpiconButton,*logouticonButton,*menubutton;
    BOOL menuslected;
    UIButton *backButton3,*backButton2,*backButton;
   UINavigationBar *navBar;
   
    UIView *CustomersBackView;
    UIScrollView *AddCustomersView;
    UIButton  *AddCustomerBtn,*EditCustomerBtn;
    
    UILabel *CustomerLbl,*firstnamelbl,*Lastnamelbl,*Emaillbl;
    UITextField *CustomerField,*FirstnameField,*LastnameField,*EmailField;
    UIButton *CustomerInfoBtn;
    UIButton *SavecustomerBtn,*CancelCustomerBtn;
    UITableView *EditCustomerTable;
    UIButton *EditBtn,*DeleteBtn;
    
    UIAlertView  *deleteCustomerAlert;
    NSInteger SelectedCustomer;
    
      NSMutableArray *CustomerNosArray,*CuFirstnamesArray,*CuLastnamesArray,*EmailsArray,*CustomerNotesArray;
    //Edit Customer View
    UIView *EditCustomersBackView;
    UIScrollView *EditAddCustomersView;
    UILabel *EditCustomerLbl,*Editfirstnamelbl,*EditLastnamelbl,*EditEmaillbl;
    UITextField *EditCustomerField,*EditFirstnameField,*EditLastnameField,*EditEmailField;
    UIButton *EditCustomerInfoBtn;
    UIButton *EditSavecustomerBtn,*EditCancelCustomerBtn;
    
    
    
    //GeneralInfo View
    UIView *GeneralInfoPopUp;
    UIScrollView *GeneralInfoView;
    UITextField *GeneralInfoField,*GeneralInfoField2;
    UILabel *GeneralInfolbl,*GeneralInfolbl2,*GeneralInfoTextlbl;
    UIButton *SaveGeneralInfoBtn,*CancelGeneralInfoBtn;
    NSString *GCompanyName,*GStreetAddress,*GStreetAddress2,*Gcity,*GCountry,*GpostalCode,*Gphone,*GAlternatePhone,*GBirthDay,*Gstate;
    
    NSMutableArray *GeneCompanyNamesArray,*GeneStreetAddressArray,*GeneStaddress2Array,*GeneCitysArray,*GeneCountrysArray,*GeneZipcodesArray,*GenephoneArray,*GeneAleternatePhonesArray,*GeneBirthDaysArray,*GeneStatesArray;
    NSString *EditGCompanyName,*EditGStreetAddress,*EditGStreetAddress2,*EditGcity,*EditGCountry,*EditGpostalCode,*EditGphone,*EditGAlternatePhone,*EditGBirthDay,*EditGstate;
    
    
    //ExtendedInfo View
    UIView *ExtendedInfopopUp;
    UIScrollView *ExtendedInfoView;
    UITextField *ExtendedField,*ExtendedField2;
    UILabel *ExtendedInfolbl,*Extendedblbl2,*ExdInfotextlbl;
    UITableView *CreadidCardListTable;
    UIButton *SaveExtendedInfoBtn,*CancelExtendedInfoBtn;
    UILabel *CreditcardInfolbl,*PersonalInfolbl;
    NSArray *CreditCardtypesArray;
    UIButton *CreditCardTypeBtn;
    UILabel *CreditCardtypelbl;
    NSString *CardNo,*cardType,*Expiration,*LicenseId,*ExpDate,*MPhone,*Fax;
    
    NSMutableArray *CardNosArray,*CardtypesArray,*ExpirationsArray,*LicensesArray,*ExpDatesArray,*MPhonesArray,*FaxesArray;
    
    NSString *EditCardNo,*EditcardType,*EditExpiration,*EditLicenseId,*EditExpDate,*EditMPhone,*EditFax;
    
    //Notes View
    UIView *NotesBackView,*NotesView;
    UITextView *NotesTextView;
    UILabel *Notestextlbl,*EnterNoteslbl;
    UIButton *SaveNotesBtn,*CancelNotesBtn;
    NSString *CustomerNotes;
    NSString *EditcustomerNotes;
    
    //Shipping view

    UIView *ShippingInfoPopUp;
    UIScrollView *ShippingInfoView;
    UITextField *ShippingInfoField,*ShippingInfoField2;
    UILabel *ShippingInfolbl,*ShippingInfolbl2,*ShippingInfoTextlbl;
    UIButton *SaveShippingInfoBtn,*CancelShippingInfoBtn;
     NSString *ShCompanyName,*ShStreetAddress,*ShStreetAddress2,*Shcity,*ShCountry,*ShpostalCode,*Shphone,*ShAlternatePhone,*ShBirthDay,*Shstate;
    NSMutableArray *ShCompanynamesArray,*ShFirstnamesArray,*ShlastnamesArray,*ShStreetsArray,*ShCitysArray,*ShCountrysArray,*ShPhonenumbersArray,*ShExdedArressArray,*ShSatesArray,*ShZipcodesArray;
    
    
     NSString *EditShCompanyName,*EditShStreetAddress,*EditShStreetAddress2,*EditShcity,*EditShCountry,*EditShpostalCode,*EditShphone,*EditShAlternatePhone,*EditShBirthDay,*EditShstate;
    
    //Stores View
    
    UIView *StoresPopupView,*StoresView;
    UILabel *Storeslbl,*StoresTextlbl;
    UITableView *StoresListTable,*StoresDataTable;
    UIButton *SavestoresBtn,*CancelStoresBtn,*StoresBtn,*DeleteStoreBtn;
    //Hiestory View
    UIView *HistoryPopupView,*HistoryView;
    UILabel *Historytextlbl;
    UIButton *saveHistoryBtn,*CancelHistoryBtn;
    
    
    NSMutableArray *StoreDataArray,*SelectedStoredataArray;
    NSMutableArray *StoredataFromdatabaseArray;
    
    
    NSURLConnection *CustomerConnection,*GeneralInfoConnection,*ExtendedConnection,*ShippingConnection,*StoreConnection;
    NSMutableData *CustomerResponseData,*GeneralResponseData,*ExtendedResponseData,*ShippingResponseData,*StoreResponseData;
    
    UILabel *sationLbl,*Timelbl,*EmpIdlbl;
    UIButton *logoBtn;
    
    
 //History
    UITableView *SalesHistoryTable;
    
     NSMutableArray *itemIDArray,*itemNameArray,*discountArray,*taxArray,*yourCostArray,*avgArray,*quantityArray,*dateArray,*SnosArray;
    
    NSString *selectedCuInvoiceId;
    NSMutableArray *InvoiceIdsArray;
    
    IBOutlet CustomerCell *customerCell;
    IBOutlet CustomerHistoryCell *customerHistoryCell;
    NSMutableDictionary *dataDict;
    
}
-(void)releaseViews;
- (IBAction)customer_editButtonClicked:(id)sender;

- (IBAction)customer_deleteButtonClicked:(id)sender;

@end
